package com.masterclient.app.modules.income;

import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;

import com.masterclient.app.BaseFragment;
import com.masterclient.app.R;
import com.masterclient.app.modules.income.adapter.ProfitTotalDialogAdapter;
import com.masterclient.app.modules.income.adapter.ProfitTypeDialogAdapter;
import com.masterclient.app.modules.income.model.ProfitsTotalPopupContentBean;
import com.masterclient.app.modules.income.model.ProfitsTypePopupBean;

import java.util.List;

import butterknife.BindView;

/**
 * @auther hjian
 * @date 2020/6/16.
 */
public class ProfitHelpFragment extends BaseFragment {


    @BindView(R.id.profit_help_recycler)
    RecyclerView profitHelpRecycler;

    private List<ProfitsTypePopupBean> profitsTypePopupBeans;
    private List<ProfitsTotalPopupContentBean> profitsTotalPopupContentBeans;

    @Override
    protected View getRootView(LayoutInflater inflater) {
        return inflater.inflate(R.layout.fragment_profit_help, null);
    }

    @Override
    protected void initOnlyOnce() {
        super.initOnlyOnce();

        profitsTypePopupBeans = (List<ProfitsTypePopupBean>) getArguments().getSerializable("profits_type");
        profitsTotalPopupContentBeans = (List<ProfitsTotalPopupContentBean>) getArguments().getSerializable("profits_total");

        profitHelpRecycler.setLayoutManager(new LinearLayoutManager(getActivity()));
        if (profitsTypePopupBeans != null){
            profitHelpRecycler.setAdapter(new ProfitTypeDialogAdapter(profitsTypePopupBeans));
        }else {
            profitHelpRecycler.setAdapter(new ProfitTotalDialogAdapter(profitsTotalPopupContentBeans));
        }

    }
}
